function createBox(){
    var boxContainer=document.createElement("div");
    var box=document.createElement("box");
    boxContainer.id="boxContainer";
    box.id="box";
    boxContainer.appendChild(box);
    document.body.appendChild(boxContainer);
}
function box(boxContainer,container, duration) {
    this.container = document.getElementById(container);
    this.boxContainer=document.getElementById(boxContainer);
    this.duration = duration || 2000;
}
box.prototype.show = function(content) {
    this.content = content || "弹出框";
    this.container.style.opacity = 1;
    this.boxContainer.style.opacity=1;
    this.container.style.display = "block";
    this.boxContainer.style.display = "block";
    this.container.innerHTML = this.content;
    setTimeout(function() {
        this.hide();
    }.bind(this), this.duration);
}
box.prototype.hide = function() {
    this.container.style.display = "none";
    this.boxContainer.style.display = "none";
}
createBox();
var box = new box("boxContainer","box");